<include file="Public/HOME/HTML/head_html_5.html" />
<meta charset="utf-8" />
<title>我的创意{$Think.const.TITLE}</title>
<include file="Public/HOME/HTML/CssAndJs.html" />
<include file="Public/HOME/HTML/middle_list.html" />
<include file="Public/HOME/HTML/ideaManagement.html" />
<!-- DataTables Example -->
<script>
	
    function delIdea(xid){ 
			var gradename = xid;
			address = "{$Think.const.DOMAIN_NAME}Home/Idea/ideaDel/iid/"+gradename; // 设置$.get调用路径
			var delTr = document.getElementById(xid);                                  // 获取动态的表格ID
			$.get(address,function(str){                                               // 方法不太明白，大概意思是获取$.get返回的值
				if(str==0){                                                            // 如果返回的时0的话就证明是对的
				ZENG.msgbox.show("删除成功！", 4, 1000);
				delTr.parentNode.removeChild(delTr);                                   // 删除该行
			}else{                                                                     // 其他情况都是原密码错误    
				ZENG.msgbox.show("删除失败！", 5, 2000);
			}
		    });	 
	}
</script>
<script src="{$Think.const.ADMINJS}Hint.js" type="text/javascript">
	
</script>
<script language="JavaScript">
	// 鏇存柊鐘舵�乀涓虹被鍒�
	function switchCommen(iid, type) {

		var axajUrl = '{$Think.const.DOMAIN_NAME}/Home/Idea/ajaxAlterIdea/';

		$
				.post(
						axajUrl,
						{
							type : type,
							iid : iid,
						},
						function(returnInfo) {

							if (returnInfo == "鏇存柊澶辫触") {
								return false;
							}

							// 鏄惁鍏佽璇勮
							if (returnInfo == "C0") {
								document.getElementById('commen_' + iid).className = "label label-success";
								$('#commen_' + iid).html("允许");
								new x.creat('Y', '设置成功');
							}
							if (returnInfo == "C1") {
								document.getElementById('commen_' + iid).className = "label label-warning";
								$('#commen_' + iid).html("不允许");
								new x.creat('Y', '设置成功');
							}

							// 璇勮鏄惁鍏紑  
							if (returnInfo == "P0") {
								document.getElementById('public_' + iid).className = "label label-success";
								$('#public_' + iid).html("公开");
								new x.creat('Y', '设置成功');
							}
							if (returnInfo == "P1") {
								document.getElementById('public_' + iid).className = "label label-warning";
								$('#public_' + iid).html("不公开");
								new x.creat('Y', '设置成功');
							}

						}, "html");//杩欓噷杩斿洖鐨勭被鍨嬫湁锛歫son,html,xml,text
	}
</script>
<div class="row" style="height: 80%">
	<div class="col-lg-10" style="float: right">
		<div class="widget-container fluid-height clearfix">
			<div class="heading">
				<i class="icon-table"></i>我的创意
			</div>
			<div class="widget-content padded clearfix">
				<table class="table table-bordered table-striped dataTable"
					id="datatable-editable">
					<thead>
						<th style="width: 10%; text-align: center">编号</th>
						<th style="width: 36%; text-align: center">标题</th>
						<th style="width: 12%; text-align: center">允许评论</th>
						<th style="width: 12%; text-align: center">是否公开</th>
						<th style="width: 20%; text-align: center;">发布时间</th>
						<th style="width: 10%; text-align: center;">操作</th>
					</thead>
					<tbody>
						<volist name="myidea" id="vo">
						<tr id="{$vo.iid}">
							<td style="text-align: center;">{$number++}</td>
							<td style="text-align: center;"><a
								href="{$Think.const.DOMAIN_NAME}Home/Idea/details/iid/{$vo.iid}"
								target="_bank">{$vo.idea}</a></td>
							<td style="text-align: center;"><if
									condition="$vo.iscomment eq '0'"> <span
									id="commen_{$vo.iid}" class="label label-success"
									onclick="switchCommen('{$vo.iid}','C')">允许</span> <else /> <span
									id="commen_{$vo.iid}" class="label label-warning"
									onclick="switchCommen('{$vo.iid}','C')">不允许</span> </if></td>
							<td style="text-align: center;"><if
									condition="$vo.ispublic eq '0'"> <span
									id="public_{$vo.iid}" class="label label-success"
									onclick="switchCommen('{$vo.iid}','P')">公开</span> <else /> <span
									id="public_{$vo.iid}" class="label label-warning"
									onclick="switchCommen('{$vo.iid}','P')">不公开</span> </if></td>
							<td style="text-align: center;">{$vo.idate}</td>
							<td style="text-align: center;"><a class="table-actions"
								href="{$Think.const.DOMAIN_NAME}Home/Idea/alterIdea/iid/{$vo.iid}"
								title="编辑"><i class="icon-pencil"></i></a>&nbsp; <a class="table-actions" 
								href="javascript:void(0);" onclick="if(confirm('確定刪除么？')==0){history.go(0); return false;}else{javascript:delIdea({$vo.iid})}"
								title="删除"><i class="icon-trash"></i></a></td>
						</tr>
						</volist>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>
<!-- end DataTables Example -->
</div>
</div>
<include file="Public/HOME/HTML/footer.html" />
</body>
</html>